//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<IEffect.h>
///	@path	~/src/graphics/
///	@date	2007/11/15
///	@desc	Effect interface.

#pragma once

#include "xeres.h"

#include "graphics/IDevice.h"
#include "graphics/IDeviceResource.h"
#include "graphics/RenderContext.h"

struct IUnknown;

namespace xeres {

	// forward declaration
	class IShaderVariable;
	class ITechnique;
	class ITexture;
	class IEffectPool;

	/*!
		\class	IEffect
		\brief	Effect interface.

		\sa ITechnqiue, IShaderVariable, IEffectCompiled
	*/
	class IEffect : public IDeviceResource
	{
	public:

		/// \name Constructor & Destructor
		//@{

		/// \ctor
		IEffect( void );

		/// \dtor
		virtual ~IEffect( void );

		//@}

		DECL_IOBJECT_INTERFACE( IEffect , IDeviceResource );

	public:

		/// \name IEffect Interface
		//@{

		/*! 
			\brief		Get effect pool.
		*/
		virtual RefWeak<IEffectPool> GetPool( void ) = 0;

		/*!
			\brief		Get effect variable count.
		*/
		virtual size_t GetVariableCount( void ) = 0;

		/*!
			\brief		Get effect variable by index.
		*/
		virtual RefPass< IShaderVariable > GetVariableByIndex( size_t index ) = 0;

		/*!
			\brief		Get effect variable by name.
		*/
		virtual RefPass< IShaderVariable > GetVariableByName( const AString& name ) = 0;

		/*! 
			\brief		Get effect variable by semantic.
		*/
		virtual RefPass< IShaderVariable > GetVariableBySemantic( const AString& semantic ) = 0;

		/*!
			\brief		Deregister variable cache.
		*/
		virtual void UnusedVariable( RefWeak< IShaderVariable > var ) = 0;

		/*!
			\brief		Get technique count.
		*/
		virtual size_t GetTechniqueCount( void ) = 0;

		/*!
			\brief		Get technique by index.
		*/
		virtual RefPass< ITechnique > GetTechnique( size_t index ) = 0;

		/*!
			\brief		Get technique by name.
		*/
		virtual RefPass< ITechnique > GetTechnique( const AString& name ) = 0;

		/*!
			\brief		Deregister technique cache.
		*/
		virtual void UnusedTechnique( RefWeak< ITechnique > tech ) = 0;

		/*! 
			\brief		Get effect interface.
		*/
		virtual IUnknown * GetEffectInterface( void ) = 0;

		//@}
	};

} // namespace xeres
